import json

from django.conf import settings
from django.http import HttpResponse

def render_json(data={}, code=200, message=''):
    result = {
        'data':data,
        'code':code,
        'message':message
    }
    pass #print(settings.DEBUG)
    if settings.DEBUG:
        json_str = json.dumps(result, indent=4, separators=[',',':'], ensure_ascii=False)
    # 中(result, separators=[',',':'], ensure_ascii=False)
    else:
        json_str = json.dumps(result, separators=[',',':'], ensure_ascii=False)
    return HttpResponse(json_str)
